package com.db4o.internal.odbgen.plugins.java.database.id;

import com.db4o.internal.odbgen.plugins.XmlSchemaElementList;
import com.db4o.odbgen.plugins.java.database.id.Id;
import com.db4o.odbgen.plugins.java.database.id.IdType;

/**
 * Contains all elements and attributes used inside XmlSchema 
 * that are processed by {@link Id}.
 * @author liviug
 */
public enum IdXmlSchemaElement implements XmlSchemaElementList {
    /**
     * This is a class level atribute that specifies whether the class has an id or not.
     * This is a boolean value.
     */
    ID("id"),

    /**
     * Specify the name of the method that will return the id.
     * By default, the name is getId(). 
     * This is a string value.
     */
    IDMETHODNAME("idMethodName", "getId"),

    /**
     * The type of the generated id. Currently, the following types are supported.
     * DB4OUUID - The UUID generated natively by db4o.
     * DB4OINTERNALID - The internal id generated natively by db4o.
     * By default it is DB4OINTERNALID. 
     * This is a string value.
     */
    IDTYPE("idType", IdType.DB4OUUID.toString());
    
    private String _name;
    private String _defaultValue;
    private IdXmlSchemaElement(String name){
        this._name = name;
        this._defaultValue = null;
    }
    
    private IdXmlSchemaElement(String name, String defaultValue){
        this._name = name;
        this._defaultValue = defaultValue;
    }
    /**
     * See {@link XmlSchemaElementList} for details.
     */
    @Override
    public String getName() {
        return _name;
    }
    
    /**
     * 
     * @return
     */
    public String getDefaultValue(){
        return this._defaultValue;
    }
}
